package src;

import pjwstk.jps.datastore.*;
import java.util.*;

/**
 * @author s9111_s10304
 *
 */
public class Main3
{
    public static void main(String[] args) {
        // pr3 - example
        System.out.println("pr3 - example");
        SBAStore store1 = new SBAStore();
        store1.loadXML(".\\s9111_s10304_pr3\\res\\pr3ex.xml");
        
        store1.PrintObjects(store1.retrieve(store1.getEntryOID()));
        System.out.println(store1.getString());

        // pr3 - loading data from XML
        System.out.println("pr3 - loading data from XML");
        SBAStore store2 = new SBAStore();
        store2.loadXML(".\\s9111_s10304_pr3\\res\\data.xml");
        
        store2.PrintObjects(store2.retrieve(store2.getEntryOID()));
        System.out.println(store2.getString());
        
        // pr3 - reading java objects
        System.out.println("pr3 - reading java objects");
        SBAStore store3 = new SBAStore();
        
        Employee emp1 = new Employee("Adam");
        emp1.employeeAge(22);
        emp1.empSalary(3455.00);
        emp1.empDesignation("Cleaner");
        
        Manager mng1 = new Manager("Nestor");
        mng1.employeeAge(34);
        mng1.empSalary(8765.00);
        mng1.empDesignation("Manager");
        
        Agent agt1 = new Agent("Fernando");
        agt1.employeeAge(33);
        agt1.empSalary(12345);
        agt1.empDesignation("Agent");
        
        Department dep1 = new Department("Sales", mng1, agt1);
        
        store3.addJavaObject(emp1, emp1.name);
        store3.addJavaObject(mng1, mng1.name);
        store3.addJavaObject(agt1, agt1.name);
        
        store3.addJavaObject(dep1, dep1.name);
        
        List<Employee> collection = new ArrayList<Employee>();
        collection.add(emp1);
        collection.add(mng1);
        collection.add(agt1);
        
        store3.addJavaCollection(collection, "EmployeeCollection");
        
        store3.PrintObjects(store3.retrieve(store3.getEntryOID()));
        System.out.println(store3.getString());
    }
}